import java.util.Scanner;


public class ACPC10A {
	public static void main (String args[]) {
		Scanner in = new Scanner(System.in);
		int firstNum = in.nextInt();
		int secondNum = in.nextInt();
		int thirdNum = in.nextInt();
		while (((secondNum - firstNum) != 0)) {
			if ((secondNum - firstNum) == (thirdNum - secondNum)) {
				System.out.println("AP " + (thirdNum + (secondNum - firstNum)));
			} else if ((secondNum / firstNum) == (thirdNum / secondNum)) {
				System.out.println("GP " + (thirdNum * (secondNum / firstNum)));
			}
			firstNum = in.nextInt();
			secondNum = in.nextInt();
			thirdNum = in.nextInt();
		}
	}
}
